//////////////////////////////////////////////////////////////
//
//  Description	: PDF2HTML/BMP software
//  Author	: verypdf.com Inc
//  Version	: Ver1.2
//  Platform	: Windows95/98/Me/NT/2000/XP
//  Environment	: Visual C++ 6.0
//  Date	: 2002/04/03
//
//  Copyright(C) 2000--2003 verypdf.com Inc
//      
//  Contact infomation:
//        http://www.verypdf.com/
//        support@verypdf.com
//
//  This program is shareware; you can redistribute and/or 
//  modify it under the terms of the GNU General Public License.
//  See the GNU General Public License for more details.
//
//               Portion base on Xpdf code
//         Copyright 1996-2003 Glyph && Cog, LLC
//////////////////////////////////////////////////////////////

#ifdef __GNUC__
#pragma implementation
#endif

#include "aconf.h"
#include <stdio.h>
#include <stddef.h>
#include <stdarg.h>
#include "GlobalParams.h"
#include "Error.h"

void CDECL error(int pos, char *msg, ...) 
{
#ifdef _DEBUG
	va_list args;
	// NB: this can be called before the globalParams object is created
	if (globalParams && globalParams->getErrQuiet()) 
		return;
	if (pos >= 0) 
	{
		//fprintf(stderr, "Error (%d): ", pos);
		TRACE("Error (%d): ", pos);
	}
	else 
	{
		//fprintf(stderr, "Error: ");
		TRACE("Error: ");
	}
	char errormsg[100];
	va_start(args, msg);
	vfprintf(stderr, msg, args);
	//vsfprintf(errormsg, msg, args);
	va_end(args);

	TRACE("%s",errormsg);
	TRACE("\n");
	//fprintf(stderr, "\n");
	//fflush(stderr);
#endif
}
